package cc.vv.baselibrary.activity;

import android.os.Build;
import android.os.Bundle;
import android.support.annotation.CallSuper;
import android.support.annotation.ColorInt;
import android.support.annotation.Nullable;
import android.support.v4.content.ContextCompat;

import cc.vv.baselibrary.R;
import cc.vv.lkbasecomponent.util.LKBarUtil;

/**
 * 公共Activity基类<p>
 *
 * @author sun.li
 */
public abstract class BaseActivity extends BoTuBaseActivity {

    @CallSuper
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        setContentView(initLayoutRes());
//        initViewHolder(initViewHolderObject());
        super.onCreate(savedInstanceState);
    }

    /**
     * 初始化界面布局文件
     */
    protected abstract int initLayoutRes();

    /**
     * 初始化界面资源对象文件
     */
//    protected abstract PublicViewHolder initViewHolderObject();

    /**
     * 初始化界面资源对象文件
     */
//    protected abstract void baseOnClick(int viewId);

    @CallSuper
    @Override
    protected void initView(@Nullable Bundle bundle) {
        super.initView(bundle);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
//            LKBarUtil.setStatusBarLightMode(this, true);
            LKBarUtil.setStatusBarColor(this, statusBarColor(), 0);
        } else {
            LKBarUtil.setStatusBarColor(this, statusBarColor());
        }
    }

    /**
     * 返回statusBar颜色
     *
     * @return
     */
    @ColorInt
    protected int statusBarColor() {
        return ContextCompat.getColor(this, R.color.color_693C26);
    }

//    /**
//     * 初始化界面中所有控件
//     */
//    private void initViewHolder(PublicViewHolder viewHolder) {
//        BaseResourceUtil.getInstance().initViewHolderResource(this, viewHolder,
//                new BaseResourceUtil.ViewEventInterface() {
//                    @Override
//                    public void viewOnClick(int resId) {
//                        baseOnClick(resId);
//                    }
//                });
//    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
    }

}
